<?php get_header();?>
<!-- Trang nha hang -->
<body>
<div id="wrapper">
	<?php require_once TEMPLATEPATH.'/views/view-header.php';?>
    <?php require_once TEMPLATEPATH.'/views/view-menu.php';?>
    <div id="header-third">
    		<!--slideshow-->
 		   	<?php require_once TEMPLATEPATH.'/views/view-slide-show.php';?>
		    <!--end slideshow--> 
            <!--container-->
         <div id="container">
         <?php require_once TEMPLATEPATH.'/views/view-breadcrumb.php';?>
         <div class="clear"></div>
         <!--main content-->
            <div id="maincontent">
            	<?php 
                        	$args = null;
							$num_post		= 5;
							$post_type		= 'news-event'; 
							$orderby		= 'date';
							$order			= 'DESC';
							$meta_key		= $wpdb->prefix.'display';
							$meta_value		= 'display';
							//$args = db_query_all_post_in_post_type($num_post, $post_type, $orderby, $order, $meta_key, $meta_value);
							$args = db_query_post_in_posttype_paged($num_post, $post_type, $meta_key, $meta_value, $paged);					
							query_posts($args);
							
                        	?>
            	
            	<div id="page-index" class="page-list-tin-09-1">                
                	<div class="tour">                    
	                    <h3>News</h3>                        
                       <div class="clear"></div>
                    	<ul>  
                    	<?php
						if(have_posts())
						{
							while (have_posts())
							{
								the_post();
								$post_id = get_the_ID();
								$title = get_the_title($post_id);
								$perlink = get_permalink($post_id);
								$thumbnail = db_get_post_meta($post_id, $wpdb->prefix.'thumbnail');
								$excerpt = db_shortDesc(get_the_content(), 200);
								$alt = db_get_alt_attachment_id($post_id, $wpdb->prefix.'thumbnail');
								if(!$alt)
									$alt = db_vietnamese_slug($title);
								?>
								<li>
				                    <p class="title-list-tin">
				                    	<a href="<?php echo $perlink;?>"><?php echo $title;?></a></p>
				                    	<div class="bg-list-tin">
				                        	<a href="<?php echo $perlink;?>">
				                        		<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumbnail;?>&w=135&h=100" border="0" alt="<?php echo $alt;?>">
				                        	</a>
				                        </div>
				                        <div class="div10"></div>
										<p class="date-publish"><?php echo unix_to_gmt_sevent_usa();?> (GMT+7)</p>
				                       <p>
										<?php echo $excerpt;?>
										</p>
			                    </li>
								<?php 
							}
							//wp_reset_query();
							$args = null;
						}
						?> 
		                </ul> 
                		<div class="clear"></div>
                        <div class="pages">
							<?php					
                            	## phân trang bằng plugin, 2 ngôn ngữ
				                    //if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
				                bt_paginate();    
				    		?>
						</div>
                               	
                    </div>
                    <div class="clear"></div>
                </div>
                
                
            </div>
            <!--main content-->
            <!--sidebar-right-->
            <?php get_sidebar();?> 
            <!--sidebar-right-->
            <div class="clear"></div> 
        </div>
        <!--container-->
        <!--bgfooter-->
<?php get_footer();?>
          